#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.63])
AC_INIT([libnbds], [0.1], [pdziepak@quarnos.org])
AC_CONFIG_HEADERS([config.h])

AM_INIT_AUTOMAKE([-Wall -Werror foreign])

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_LIBTOOL
AC_PROG_INSTALL

# Checks for libraries.
AC_CHECK_LIB([pthread], [pthread_create],,AC_MSG_ERROR([pthread not found]))

# Checks for header files.
AC_CHECK_HEADER([pthread.h],,AC_MSG_ERROR([pthread.h not found]))

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.
AC_FUNC_ERROR_AT_LINE

AC_CONFIG_FILES([
        Makefile
        src/Makefile
	tests/Makefile
])

# Define needed macros
case $host_cpu in
	i*86)
		AC_SUBST(arch, [i386])
		AC_DEFINE([NBDS_CAS2],,[CAS2 available])
		;;
	x86_64)
		AC_SUBST(arch, [x86_64])
		AC_DEFINE([NBDS_CAS2],,[CAS2 available])
		;;
esac

AC_OUTPUT
